<template>
  <div>
    <van-tabs v-model="n" id="current">
      <van-tab :title="item" v-for="(item,index) in navs" :key="item" @click="n=index">
        <goods-list :arr="arr[n].content" v-if="arr.length>0"></goods-list>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { getHortGoods } from "../../../http/http";
export default {
  data() {
    return {
      navs:["热门推荐","上新推荐","所有商品"],
      arr: [],
      n:0
    };
  },
  mounted() {
    getHortGoods().then((res) => {
      // console.log("获取首页商品信息的数据");
      this.arr=res.data.list;
    });
  },
};
</script>

<style scoped>

</style>